<template>
  <div class="activity">
    <div class="toolbar">
      <el-button icon="el-icon-refresh" :loading="loading"></el-button>
      <el-button type="primary" @click="add">发布活动</el-button>
    </div>

    <el-table :data="data" v-loading="!loading">
      <el-table-column label="名称" prop="name"></el-table-column>
      <el-table-column label="地址" prop="address"></el-table-column>
      <el-table-column label="主办单位" prop="organizers"></el-table-column>
      <el-table-column label="活动时间">
        <template slot-scope="{row}">{{ row.start_time }} - {{ row.end_time }}</template>
      </el-table-column>
      <el-table-column label="票价" prop="price"></el-table-column>
      <el-table-column label="状态" prop="status">
        <template slot-scope="{row}">{{ row.status | activityStatus }}</template>
      </el-table-column>
      <el-table-column label="活动发布时间">
        <template slot-scope="{row}">
          <span v-if="row.publish === 0">{{ row.create_time }}</span>
          <span v-else>{{ row.publish }}</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" fixed="right" width="120px">
        <template slot-scope="{row}">
          <el-button size="small" type="primary">编辑</el-button>
          <el-button size="small" type="info">查看座位</el-button>
          <el-button size="small" type="danger">删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <el-pagination
      :hide-on-single-page="true"
      :total="pageTotal"
      :pageSize="pageSize"
      layout="prev, pager, next, jumper, ->, total"
      @current-change="changePage"
    ></el-pagination>
  </div>
</template>
<script>
import table from '../../../mixins/table'
export default {
  name: 'ActivityIndex',
  mixins: [table],
  methods: {
    add () {
      this.$router.push('/Admin/Activity/Add')
    }
  }
}
</script>
<style lang="stylus"></style>
